import node.FourNode;

import java.util.Arrays;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) {
        //TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
        // to see how IntelliJ IDEA suggests fixing it.
        System.out.printf("Hello and welcome!");

        //生成一棵N层满二叉树
        //n层满二叉树的结点总数计算公式为 (2^n - 1)
        //每一层最大数量 2^(i-1)
        double level=4;
        double count=Math.pow(2L,level)-1.0;
        Tree.creatCompleteBinaryTree((int) count,"");

        System.out.println();
        System.out.println("数字转字母");
        int a=4;
        char c= (char) ('A'+a-1);
        System.out.println(c);


        System.out.println();
        System.out.println("快速排序");
        var arr=new int[]{13,5,8,4,12,6,11,18,2};
        Sort.quickSort(arr,0,arr.length-1);
        //Arrays.stream(arr).forEach(d->System.out.print(d+" "));
        System.out.println("arr = " + Arrays.toString(arr));

        //生成矩阵
        FourNode.createMatrix(4);

        System.out.println();
        System.out.println("堆排序");
        arr=new int[]{13,5,8,4,12,6,11,18,2};
        Sort.heapSort(arr);
        //Arrays.stream(arr).forEach(d->System.out.print(d+" "));
        System.out.println("arr = " + Arrays.toString(arr));
    }
}